﻿using Panuon.UI.Silver;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using WpfBill.Data;

namespace WpfBill.GUI
{
    /// <summary>
    /// WinEnterprise.xaml 的交互逻辑
    /// </summary>
    public partial class WinEnterprise : WindowX
    {
        public WinEnterprise()
        {
            InitializeComponent();
        }
        private void Reset()
        {
            txtName.Text = "";
            txtAccount.Text = "";
            txtManager.Text = "";
            txtPhone.Text = "";
        }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Enterprise enterprise = new Enterprise();
                enterprise.Name = txtName.Text.Trim();
                enterprise.Account = txtAccount.Text.Trim();
                enterprise.Person = txtManager.Text.Trim();
                enterprise.Phone = txtPhone.Text.Trim();
                enterprise.CreateTime = DateTime.Now;
                enterprise.Insert();
                if (chkContinue.IsChecked == true)
                    Reset();
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {

            }
        }
    }
}
